<template>
  <component ref="formIndex" v-model="value" :is="formKey" :viewer="viewer" />
</template>
<script>
import leaveForm from './leaveForm.vue'
import articleAuditForm from './articleAuditForm.vue'

export default {
  name: 'FormIndex',
  components: {
    leaveForm,
    articleAuditForm
  },
  props: {
    formKey: {
      type: String,
      default: undefined
    },
    value: {
      type: Object,
      default() {
        return {}
      }
    },
    viewer: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
    }
  },
  methods: {
    validate(callback) {
      return this.$refs['formIndex'].validate(callback)
    },
    resetFields() {
      this.$refs['formIndex'].resetFields()
    },
    getFormData() {
      console.log(this.$refs[this.formKey])
      return this.$refs['formIndex'].form
    }
  }
}
</script>
